﻿
@{
    ViewBag.Title = "安全";
    Layout = "~/Views/Shared/_LayoutEmergency.cshtml";
}

@section css {
    <link type="text/css" href="~/Assets/Styles/libs/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <link type="text/css" href="~/Assets/Styles/libs/sco.message.css" rel="stylesheet" />
    <link href="~/Assets/Styles/libs/fileinput.css" rel="stylesheet" />
}
<style>
    .kv-file-upload {
        display: none;
    }


    .div-relative {
        position: relative;
    }

    .div-a {
        position: absolute;
    }

    #location {
        position: absolute;
        z-index: 100;
        width: 10px;
        height: 10px;
        color: red;
        font-weight: bold;
    }
</style>
<div class="nesting main-content" ng-controller="SpecialController" ng-init="
     id='@(Request.QueryString["Id"].IsEmpty() ? "0" : Request.QueryString["Id"])';GetRiskLevel();
     page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     GetRiskForm(id);
     ">
    <div ng-cloak ng-show="PageLoading">
        <div style="text-align: center; padding-top: 140px;">
            <img src="../../Assets/Images/loading.gif" />
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="col-lg-12">
                <div class="panel panel-info">
                    <div class="panel-heading">
                        <h1 class="panel-title">编辑风险分级管控</h1>
                    </div>
                    <div class="panel-body">
                        <form role="form" class="form-horizontal" id="docForm" name="frmPlanEdit" enctype="multipart/form-data">
                            <div class="form-group">
                                <label class="col-lg-2 control-label">建筑物名称：</label>
                                <div class="col-lg-8">
                                    <input type="text" class="form-control" name="BuildingName" ng-model="RiskForm.WorkSpaceName" maxlength="50" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">厂区：</label>
                                <div class="col-lg-8">
                                    <select class="form-control" name="FactoryAreaId" ng-model="RiskForm.FactoryAreaId">
                                        <option value="1">浦东</option>
                                        <option value="2">大场</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">风险等级：</label>
                                <div class="col-lg-8">
                                    <select class="form-control" name="LevelId" ng-model="RiskForm.LevelId">
                                        <option value="">请选择风险等级</option>
                                        <option ng-repeat="x in RiskLevelList" value="{{x.Id}}">{{x.LevelName}}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">建筑物位置：</label>
                                <div class="col-lg-8">
                                    <div class="div-relative" id="mapContent">
                                        <div id="location" ng-style="{'left':RiskForm.X+'%','top':RiskForm.Y+'%'}">
                                            <img src="~/Assets/Images/location.png" width="30" />
                                        </div>
                                        <img src="~/Assets/Emergency/img/pvg.png" style="width:100%;" ng-show="RiskForm.FactoryAreaId==1" />
                                        <img src="~/Assets/DashBoard/images/dcArea.jpg" style="width:100%;" ng-show="RiskForm.FactoryAreaId==2" />
                                    </div>

                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">坐标：</label>
                                <div class="col-lg-1">
                                    <input type="text" class="form-control" name="X" id="h_XAxis" ng-model="RiskForm.X" value="50" maxlength="50" readonly />
                                </div>
                                <div class="col-lg-1">
                                    <input type="text" class="form-control" name="Y" id="h_YAxis" maxlength="5" ng-model="RiskForm.Y" value="50" readonly />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">备注：</label>
                                <div class="col-lg-8">
                                    <textarea rows="2" class="form-control" name="Remark" ng-model="RiskForm.Remark" maxlength="200"></textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">已上传文件：</label>
                                <div class="col-lg-8">
                                    <table class="table table-striped table-bordered">
                                        <thead>
                                            <tr class="active">
                                                <th style="width: 5%">@Resources.WebStringsBase.No</th>
                                                <th style="width: 10%">文件名</th>
                                                <th style="width: 20%">大小(kb)</th>
                                                <th style="width: 20%">类型</th>
                                                <th style="width: 10%">操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td colspan="4" ng-show="RiskForm.FileList.length==0">
                                                    <p class="text-center" style="padding: 40px;">@Resources.WebStringsBase.NoRecord</p>
                                                </td>
                                            </tr>
                                            <tr ng-repeat="x in RiskForm.FileList" ng-cloak>
                                                <td style="text-align: center">
                                                    <div ng-bind="$index+1"></div>
                                                </td>
                                                <td>
                                                    <div ng-bind="x.FileName"></div>
                                                </td>
                                                <td>
                                                    <div ng-bind="x.FileSize"></div>
                                                </td>
                                                <td>
                                                    <div ng-bind="x.FileExtension"></div>
                                                </td>
                                                <td>
                                                    <div><a href="../Download/DownloadRiskFile?FileId={{x.Id}}">下载</a> | <a>删除</a></div>
                                                </td>
                                            </tr>
                                        </tbody>


                                    </table>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">文件<span class="not-null"></span></label>
                                <div class="col-lg-8">
                                    <input type="file" ngf-select ng-model="doc.Files" name="docfiles" id="docfiles" class="file" initialPreviewAsData="true" data-show-remove="true" data-show-preview="true" showCancel="false" data-show-upload="false" multiple required>
                                </div>
                            </div>
                        </form>

                        <div class="form-group">
                            <div class="col-lg-2">

                            </div>
                            <button type="submit" class="btn btn-primary col-lg-offset-1" ng-click="EditRiskForm(RiskForm.Id,page);" ng-cloak><span ng-cloak><span class="glyphicon glyphicon-saved" style="padding-right: 5px"></span>@Resources.WebStringsBase.Save</span></button>
                            <a style="margin-left: 45px" class="btn btn-default" href="../Emergency/RiskFormPageList?page={{page}}"><span class="glyphicon glyphicon-menu-left" style="padding-right: 5px"></span><span>@Resources.WebStringsBase.Back</span></a>
                        </div>
                    </div>
                </div>

            </div>
        </div>


    </div>


</div>


@section js {

    <script type="text/javascript" src="~/Assets/Scripts/pg/Special.js"></script>
    <script type="text/javascript" src="~/Assets/Scripts/libs/moment.min.js"></script>
    <script type="text/javascript" src="~/Assets/Scripts/libs/sco.message.js"></script>
    <script type="text/javascript" src="~/Assets/Scripts/libs/locales/date/zh-cn.js"></script>
    <script type="text/javascript" src="~/Assets/Scripts/libs/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="~/Assets/Scripts/libs/angularjs-datepicker.js"></script>
}
<script type="text/javascript" src="~/Assets/Scripts/libs/fileinput.js"></script>
<script type="text/javascript" src="~/Assets/Scripts/libs/sortable.js"></script>
<script type="text/javascript" src="~/Assets/Scripts/libs/piexif.js"></script>
<script type="text/javascript" src="~/Assets/Scripts/libs/purify.js"></script>
<script type="text/javascript" src="~/Assets/Scripts/libs/theme.js"></script>
<script type="text/javascript" src="~/Assets/Scripts/libs/zh.js"></script>

<script>
    $('#docfiles').fileinput({
        language: 'zh'
    });
    $("#mapContent").mousedown(function (e) {
        var width = $("#mapContent").width();
        var height = $("#mapContent").height();
        mouseX1 = ((e.pageX - $("#mapContent").offset().left) / width) -0.01;
        mouseY1 = ( (e.pageY - $("#mapContent").offset().top) / height)-0.01;
        $("#location").css({ 'left': mouseX1 * 100 + '%', 'top': mouseY1 * 100 + '%' });
        $("#h_XAxis").val(mouseX1*100);
        $("#h_YAxis").val(mouseY1*100);
    });
</script>

